<!DOCTYPE html>  
<html>  
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        img {
            display: block;
            margin-bottom: 50px;
            width: 50%;
            height: 400px;
        }
    </style>
</head>
<body>
    <img src="default.png" data-src="http://ww4.sinaimg.cn/large/006y8mN6gw1fa5obmqrmvj305k05k3yh.jpg" alt="">
    <img src="default.png" data-src="http://h5.sztoda.cn/static/img/loveLetter/teacher/teacher3.jpg" alt="">
    <img src="default.png" data-src="http://ww1.sinaimg.cn/large/006y8mN6gw1fa7kaed2hpj30sg0l9q54.jpg" alt="">
    <img src="default.png" data-src="http://h5.sztoda.cn/static/img/loveLetter/teacher/teacher4.jpg" alt="">
    <img src="default.png" data-src="http://4493bz.1985t.com/uploads/allimg/140628/1-14062Q33R6.jpg" alt="">
    <img src="default.png" data-src="http://h5.sztoda.cn/static/img/loveLetter/teacher/teacher5.jpg" alt="">
    <img src="default.png" data-src="http://ww4.sinaimg.cn/large/006y8mN6gw1fa5obmqrmvj305k05k3yh.jpg" alt="">
    <img src="default.png" data-src="http://img.bizhi.sogou.com/images/2014/12/10/997251.jpg" alt="">
    <img src="default.png" data-src="http://ww1.sinaimg.cn/large/006y8mN6gw1fa7kaed2hpj30sg0l9q54.jpg" alt="">
    <img src="default.png" data-src="http://4493bz.1985t.com/uploads/allimg/140710/1-140G0161612.jpg" alt="">
    <img src="default.png" data-src="http://4493bz.1985t.com/uploads/allimg/140628/1-14062Q33R6.jpg" alt="">

<script>
    var num = document.getElementsByTagName('img').length;
    var img = document.getElementsByTagName("img");
    var n = 0; //存储图片加载到的位置，避免每次都从第一张图片开始遍历
    lazyload(); //页面载入完毕加载可是区域内的图片
    window.addEventListener('scroll',throttle(lazyload,500,1000));
    function lazyload(event) { //监听页面滚动事件
        var seeHeight = document.documentElement.clientHeight; //可见区域高度
        var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; //滚动条距离顶部高度
        for (var i = n; i < num; i++) {
            if (img[i].offsetTop < seeHeight + scrollTop) {
                if (img[i].getAttribute("src") == "default.png") {
                    img[i].src = img[i].getAttribute("data-src");
                }
                n = i + 1;
            }
        }
    }
    function throttle(fun, delay, time) {
    var timeout,
        startTime = new Date();
    return function() {
        var context = this,
            args = arguments,
            curTime = new Date();
        clearTimeout(timeout);
        // 如果达到了规定的触发时间间隔，触发 handler
        if (curTime - startTime >= time) {
            fun.apply(context, args);
            startTime = curTime;
            // 没达到触发间隔，重新设定定时器
        } else {
            timeout = setTimeout(fun, delay);
        }
    };
};
</script>
</body>
</html>  